import json
with open('.\\Resource\\newdata_gp5.json','r',encoding='utf-8') as f:
    datas = json.load(f)
    for data in datas:
        content = data['content']
        print(content)
        try:
            cs = content.split('[答案]')
            data['answer'] = cs[1]
            data['content'] = cs[0]
        except Exception:
            try:
                cs = content.split('答：')
                data['answer'] = cs[1]
                data['content'] = cs[0]
            except Exception:
                cs = content.split('答案')
                data['answer'] = cs[1]
                data['content'] = cs[0]
        data['language'] = 'python'

    with open('.\\Resource\\after_deal.json', 'w',encoding='utf-8') as file:
        file.write(json.dumps(datas, ensure_ascii=False, indent = 4))